package com.xoa.controller.HSTmeeting;

import com.xoa.model.HSTmeeting.HstMeetingWithBLOBs;
import com.xoa.model.HSTmeeting.HstRoom;
import com.xoa.model.HSTmeeting.HstRoomWithBLOBs;
import com.xoa.model.meet.MeetingRoomWithBLOBs;
import com.xoa.service.HSTmeeting.HstMeetRoomService;
import com.xoa.service.meeting.MeetRoomService;
import com.xoa.util.ToJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@RequestMapping("/hstMeetingRoom")
@Controller
public class HstMeetingRoomController {
    @Autowired
    HstMeetRoomService hstMeetRoomService;

    @RequestMapping("/myHstMeeting")
    public String myHstMeeting() {
        return "app/HSTmeeting/myMeeting";
    }

    /**
     * 全部会议室数据展示
     * @param page
     * @param pageSize
     * @param useFlag
     * @return
     */
    @RequestMapping("/getAllMeetRoomInfo")
    @ResponseBody
    public ToJson<HstRoomWithBLOBs> getAllMeetRoomInfo(Integer page, Integer pageSize, boolean useFlag){
        return hstMeetRoomService.getAllHstMeetRoomInfo(page,pageSize,useFlag);
    }
    @RequestMapping("/getAllMeetRoomAll")
    @ResponseBody
    public ToJson<HstRoomWithBLOBs> getAllMeetRoomAll(Integer page, Integer pageSize, boolean useFlag){
        return hstMeetRoomService.getAllMeetRoomAll(page,pageSize,useFlag);
    }

    /**
     * 新增会议室
     * @param hstRoomWithBLOBs
     * @return
     */
    @RequestMapping("/insertMeetRoom")
    @ResponseBody
    public ToJson<HstRoomWithBLOBs> insertMeetRoomInfo(HstRoomWithBLOBs hstRoomWithBLOBs){
        return hstMeetRoomService.insertMeetRoomInfo(hstRoomWithBLOBs);
    }

    /**
     * 修改会议室
     * @param hstRoomWithBLOBs
     * @return
     */
    @RequestMapping("/updateMeetingRoom")
    @ResponseBody
    public ToJson<HstRoomWithBLOBs> updateMeetingRoom(HstRoomWithBLOBs hstRoomWithBLOBs){
        return hstMeetRoomService.uodateMeetingRoom(hstRoomWithBLOBs);
    }

    /**
     * 删除会议室
     * @param roomId
     * @return
     */
    @RequestMapping("/deleteMeetingRoom")
    @ResponseBody
    public ToJson<HstRoomWithBLOBs> deleteMeetingRoom(String roomId){
        return hstMeetRoomService.deleteMeetingRoom(roomId);
    }
    @RequestMapping("/selectMeetRoomManager")
    @ResponseBody
    public ToJson<HstRoomWithBLOBs> selectMeetRoomManager(Integer roomId){
        return hstMeetRoomService.selectMeetRoomManager(roomId);
    }

    /**
     * 我的会议
     * @param request
     * @param hstMeetingWithBLOBs
     * @param page
     * @param pageSize
     * @param useFlag
     * @return
     */
    @RequestMapping("/myHstMeetings")
    @ResponseBody
    public ToJson<HstMeetingWithBLOBs> myHstMeetings(HttpServletRequest request, HstMeetingWithBLOBs hstMeetingWithBLOBs, Integer page, Integer pageSize, boolean useFlag){
        return hstMeetRoomService.myHstMeeting(request,hstMeetingWithBLOBs,page,pageSize,useFlag);
    }


    /**
     * 我的会议查看详情
     * @param meetId
     * @return
     */
    @RequestMapping("/queryHstMeetingById")
    @ResponseBody
    public ToJson<HstMeetingWithBLOBs> queryHstMeetingById(String meetId,HttpServletRequest request){
        return hstMeetRoomService.queryHstMeetingById(meetId,request);
    }

}
